<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <script>
    // 请实现一个函数，把字符串 s 中的每个空格替换成"%20"。
    let s = "We are happy."

    for(let i=0; i<s.length;i++) {
        if (s[i] === ' ') {
            
        }
    }
    </script>
</body>
</html>